package jmine.tec.web.servlet.rest;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Classes que querem ser "servidas" como REST-like devem implementar esta interface
 * 
 * @author takeshi
 */
public interface RestService {

    /**
     * Faz um request 'get'
     * 
     * @param request {@link HttpServletRequest}
     * @param response {@link HttpServletResponse}
     * @throws IOException e
     */
    void get(HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Faz um request 'put'
     * 
     * @param request {@link HttpServletRequest}
     * @param response {@link HttpServletResponse}
     * @throws IOException e
     */
    void put(HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Faz um request 'post'
     * 
     * @param request {@link HttpServletRequest}
     * @param response {@link HttpServletResponse}
     * @throws IOException e
     */
    void post(HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Faz um request 'delete'
     * 
     * @param request {@link HttpServletRequest}
     * @param response {@link HttpServletResponse}
     * @throws IOException e
     */
    void delete(HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Devolve o prefixo que este servico responde
     * 
     * @return {@link String}
     */
    String getPreffix();

}
